<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 样式文件的引入 -->
	<link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	<!-- jqueryUI国际化 -->
	<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发使用的公用js方法 -->
	<script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
  </head>
  
  <body>
    <div class="easyui-layout" data-options="fit:true,border:false" >
			<div data-options="region:'north',border:false" style="padding: 4px;height: 80px;overflow: hidden;">
			<div class="easyui-panel" data-options="fit:true,border:true" >
			<div  class="queryContent">
				<form name="searchProjectsForm" id="searchProjectsForm" method="post" action="" style="display: none; ">
				<table class="queryTable" >
					<tbody>
						<tr>
							<th >项目名称</th>
							<td width="10%">
								<input id="name" class="easyui-validatebox" type="text" name="name"  maxlength="50" style="width:120px;height: 15px;"/>
							</td>
							<th>项目编号</th>
							<td>
							 	<input id="code" class="easyui-validatebox" type="text" name="code"  maxlength="20" style="width:120px;height: 15px;"/>
							</td>
							<th >项目类型</th>
							<td width="10%">
								<select class="easyui-combobox" name="catagoryId" style="width:120px;;height: 25px;" data-options="">
									<option value="">--请选择--</option>
									<c:forEach items="${projectTypeList}" var="type">
										<option value="${type.id}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
							<!-- 
								<th >资金来源</th>
							<td>
							 	<select id="moneySource" style="width:120px" class="easyui-combobox" name="moneySource">
							 		<option value="">--请选择--</option>
									<c:forEach items="${frame:dictChildren('moneySource')}" var="type">
										<option value="${type.value}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
							 -->
							<th  >状态</th>
							<td>
							 	<select id="status" style="width:120px;height: 25px;" class="easyui-combobox" name="status">
							 		<option value="">--请选择--</option>
									<c:forEach items="${frame:dictChildrenByRole('proj_status','bidder')}" var="type">
										<option value="${type.value}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
						</tr>
						<tr>
							<th>创建时间</th>
							<td align="right" colspan="5">
								<input id="startTime" class="easyui-datebox" type="text" name="startTime"  data-options="validType:['dateTimeLessCompare[\'stopTime\']']" maxlength="20" style="width:120px;height: 25px;"/>-<input id="stopTime" class="easyui-datebox" type="text"  data-options="validType:['dateTimeMoreCompare[\'startTime\']']" name="stopTime" maxlength="20" style="width:120px;height: 25px;"/>
							</td>
							<!-- 
							<th>预算金额(元)</th>
							<td>
							 	<input id="startMoney" class="easyui-validatebox" type="text" name="startMoney"  data-options="validType:['rangeLessCompare[\'endMoney\']']" maxlength="20" style="width:120px"/>-<input id="endMoney" class="easyui-validatebox" type="text"  data-options="validType:['rangeMoreCompare[\'startMoney\']']" name="endMoney" maxlength="20" style="width:120px"/>
							</td>
							-->
							<th></th>
							<td align="right" colspan="3">
								<a href="javascript:void(0);" class="easyui-linkbutton" id="searchProjects" iconcls="icon-search" plain="true">查询</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" id="resetsearchProjects" iconcls="icon-reset" plain="true">清空</a>
							</td>
						</tr>
					</tbody>
				</table>
				</form>
			</div>
			</div>
			</div>
			<div data-options="region:'center',border:false" style="padding: 4px;">
		    <table id="listProjectsTable" class="easyui-datagrid" 
				data-options="singleSelect:false,toolbar:'#goodstb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:true,
					pagination:true,multiSort:true,remoteSort:true,striped:true,
					url:'${ctx}/business/projectmanage/bidder/bidList?roleId=bidder'"}>
				<thead>
					<tr>
						<th data-options="field:'name',width:170,title:'项目名称',sortable:true" align="center"></th>
						<th data-options="field:'code',width:90,title:'项目编号',sortable:true" align="center"></th>
						<th data-options="field:'catagoryName',width:80,title:'项目类型',sortable:true" align="center"></th>
						<th data-options="field:'auditable',width:80,title:'竞价发起人',sortable:true,formatter: function(value,row,index){if(value==true){return '公共资源交易中心';}else{{return '采购人';}}}" align="center"></th>
						<th data-options="field:'buyName',width:120,title:'采购人',sortable:true" align="center"></th>
						<th data-options="field:'manageName',width:100,title:'项目负责人',sortable:true" align="center"></th>
						<th data-options="field:'createTime',width:100,title:'创建时间',sortable:true" align="center"></th>
						<th data-options="field:'bidStartTime',width:80,title:'开标时间 ',sortable:true" align="center"></th>
						<th data-options="field:'statusName',width:80,title:'状态',sortable:true" align="center"></th>
						<th data-options="field:'operation',width:160,title:'操作'" align="center"></th>
				</tr>
				</thead>
			</table>
			
			<!----------------------- wei start --------------------->
			<!--导出Excel -->
			<input type="hidden" id="excel_error" value="${requestScope.excel_error }"/>
			<script type="text/javascript">
		    	//导出
				function excelexport(){
					$("form").attr("action","${ctx}/business/projectmanage/export")
					$("form").submit();

					var val=$("#excel_error").val();
					if(val!=""){//不为空提示错误消息
						 $.messager.alert("操作提示", val,"error");  
					}
				}
				
		    </script>
			<!----------------------- wei end --------------------->		
		</div>
	</div>
	<div id="bindPicDialog"></div>
	<div id="selPicDialog"></div>
	<div id="noCompetReasonDialog"></div>
</body>
	<script type="text/javascript">
		//初始化表格对应的js对象
		var projectsParamObj;
		$(function() {
			//初始化表格对象数据
			projectsParamObj = new initParams(
					{
						paramObjName : 'projectsParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listProjectsTable',
						addDataFormId:'addProjectsDataForm',
						showDialogId:'firstLevelDialog',
						searchID:'searchProjects',
						resetSearchID:'resetsearchProjects',
						searchFormID:'searchProjectsForm',
						updateUrl:"${ctx}/business/projectmanage/input?projectId=",
						deleteUrl:'${ctx}/business/projectmanage/remove',
						addDialogWidth:700,
						addDialogHeight:520,
						ctx:'${ctx}',
						addDialogTitle:'投标信息'
					});
			//初始化查询
			init(projectsParamObj);
			//setTimeout(function(){
				//$.parser.parse(".optionsAreas");
			//},1000);
		});
		
		/**
		 * 操作按钮处理
		 * @param {Object} value
		 * @param {Object} row
		 * @param {Object} index
		 */
		function getOptionsBtn(value, row, index){
			var btnsHtml = "<span class='optionBtnsArea'>";
			//var doSubmitHtml = '<a href="javascript:void(0)" onclick="doSubmit(\'' + row.id + '\')" class="">提交</a>&nbsp;';
			//var toUpdateHtml = '<a href="javascript:void(0)" onclick="openDataDialog(projectsParamObj,\'' + row.id + '\')" class="">修改</a>&nbsp;';
			//var callBackHtml = '<a href="javascript:void(0)" onclick="doCallback(\'' + row.id + '\')" class="">撤回</a>&nbsp;';
			var infoViewHtml = '<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">项目详情</a>&nbsp;';
			//var cancelHtml = '<a href="javascript:void(0)" onclick="doCancel(\'' + row.id + '\')" class="">撤销</a>&nbsp;';
			var shotHtml = '<a href="javascript:void(0)" onclick="shot(projectsParamObj,\'' + row.id + '\')" class="">竞价</a>&nbsp;';
			var uploadContractHtml='<a href="javascript:void(0)" onclick="uploadContract(\'' + row.id + '\')" class="">上传合同</a>&nbsp;';
			
			btnsHtml+=shotHtml;
			btnsHtml+=infoViewHtml; 
			
			return btnsHtml +"</span>";
		}


		 
		 var btsubmit;//报价投标按钮
		 /**
		 * 竞价操作
		 */
		function shot(paramObj,id){
			if(id == undefined){
				id='';
			}
			var sign = false;
			top.$('#'+paramObj.showDialogId).dialog({    
			    title:paramObj.addDialogTitle,   
			    iconCls:'icon-view',
			    width: paramObj.addDialogWidth+130,    
			    height: paramObj.addDialogHeight,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    close: afterClosed,
			    href: "${ctx}/business/projectmanage/bidder/shotInput?projectId="+id,    
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{text:'提交',
			    		id:'btsubmit',
						iconCls:'icon-ok',
						handler:function(){
			    			submitEntity();
			    			if(top.$('#'+paramObj.addDataFormId).form('validate')){//表单校验是否通过
			    				btsubmit=$(this).find("span").parent();
				    			$(this).find("span").parent().css("display","none");//隐藏提交按钮
			    			}
						}
					},
					{text:'保存',
			    		id:'commitEntityBt',
						iconCls:'icon-ok',
						handler:function(){
							top.$('#commitEntityBt').linkbutton('disable');
			    			saveEntity();
						}
					},{
						text:paramObj.cancelButton,//取消
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#'+paramObj.showDialogId).dialog('close');
						}}],
				onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
					top.$(".uploadify").each(function() {
						//alert($(this).parent().parent().find(".uploadify").attr("id"));
						var uploadId=$(this).parent().parent().find(".uploadify").attr("id");
						//alert("#"+uploadId);
						top.$("#"+uploadId).uploadify('destroy');//销毁文件上传对象....
					});
					
					if(top.$('#'+paramObj.showDialogId).find("object").length > 0){
						var fileQueue = top.window.document.getElementById("fileQueue");
						fileQueue.innerHTML = "";
						fileQueue.parentNode.removeChild(fileQueue);
					}
					afterClosed();
				}
			});
			top.$('#'+paramObj.showDialogId).dialog("center");
		}

		/**保存操作*/
		function saveEntity(){
			debugger;
			$.ajax({
				type: "POST",
				timeout:20000,
				url:  top.$("#addProjectsDataForm").attr("saveaction"),//"${ctx}/business/projectmanage/bidder/saveShot",
				data: top.$('#addProjectsDataForm').serialize(),
				success: function(data,res){
					if(data == 'success'){
						top.$.messager.alert("提示",'保存成功','info',function(){
							top.$('#firstLevelDialog').dialog('close');
							top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
							top.$('#listProjectsTable').datagrid('reload');
						});
					} else if(data=='nobid'){
						top.$.messager.alert("提示",'保存成功！','info',function(){
							top.$('#firstLevelDialog').dialog('close');
							top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
							$('#listProjectsTable').datagrid('reload');
						});
					}else if(data=='noqualificabid'){
						top.$.messager.alert('提示',"投标失败！您未缴纳保证金!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=='noregqualificabid'){
						top.$.messager.alert('提示',"投标失败！您无此项目类型的投标资格!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=='atypism'){
						top.$.messager.alert('提示',"投标失败！银行户名与系统帐户名不一致!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}
					else{
						top.$.messager.alert('提示',"保存失败！",'info');
						top.$('#commitEntityBt').linkbutton('enable');
					}
				},
				error: function(res){
					top.$('#commitEntityBt').linkbutton('enable');
				}
			});
		}
		
		/**
		*提交按钮操作
		*/
		function submitEntity(){
			if(top.$('#firstLevelDialog').form('validate')){//表单校验是否通过
				$.ajax({
					type : "post",
					url : top.$("#addProjectsDataForm").attr("action"),//"${ctx}/business/projectmanage/bidder/doSubmitShot?r="+new Date().getTime(),
					data : top.$("#addProjectsDataForm").serialize(),
					success : function(data){
						if(data=="success"){
							debugger;
							top.$.messager.alert("提示",'提交成功','info',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						}else if(data=='nobid'){
							debugger;
							top.$.messager.alert("提示",'提交成功','info',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						} else if(data=='nosubmitbid'){
							top.$.messager.alert('提示',"投标失败！当前时间不能提交，请于开标前30分钟内提交!",'error',function(){
								btsubmit.css("display","inline-block");//显示提交按钮
							});
						} else if(data=='exitbid'){
							top.$.messager.alert('提示',"投标失败！您已经投过标了!",'error',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						}else if(data=='noqualificabid'){
							top.$.messager.alert('提示',"投标失败！您未缴纳保证金!",'error',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						}else if(data=='noregqualificabid'){
							top.$.messager.alert('提示',"投标失败！您无此项目类型的投标资格!",'error',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						}else if(data=='outBudgetAmount'){
							top.$.messager.alert('提示',"投标失败！当前报价大于预算金额!",'error',function(){
								btsubmit.css("display","inline-block");//显示提交按钮
							});
							
						}else if(data=='atypism'){
							top.$.messager.alert('提示',"投标失败！银行户名与系统帐户名不一致!",'error',function(){
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							});
						}
						else{
							top.$.messager.alert("提示",'提交失败!');
						}
					},
				error : function(data){
					top.$.messager.alert("提示",'提交失败!');
				}
				});
			}
		}


		/**
		*校验中标人是否缴纳履约保证金
		**/
		function uploadContract(id){
			$.ajax({
				type: "POST",
				timeout:20000,
				url:  "${ctx}/business/projectmanage/public/validBidBond?id="+id,
				data: {},
				success: function(data){
					if(data ==true){
						validBidBond(id);//打开上传合同页面
					}else {
						top.$.messager.alert('提示',"中标人履约保证金未缴纳，请缴纳后再操作！",'error');
					}
				},
				error: function(res){
					
				}
			});
		}
		
		
		/**
		 * 上传合同操作
		 */
		 function validBidBond(id){
				 		top.$('#firstLevelDialog').dialog({
				 			title:"上传合同",  
						    iconCls:'icon-view',
						    width: '600',    
						    height: '400',    
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/projectmanage/uploadContract?projectId="+id,   
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							},
						    buttons : [{text:'提交',
									iconCls:'icon-ok',
									id:'commitEntityBt',
									handler:function(){
										if(top.$("#budgetMenuData").val()==''){
											top.$.messager.alert('提示',"合同附件不能为空！",'info',function(){});
											return;
										}
										top.$('#commitEntityBt').linkbutton('disable');
										if(top.$('#addApproveResonForm').form('validate')){
											$.ajax({
												type: "POST",
												timeout:20000,
												url:  "${ctx}/business/projectmanage/doSubmitContract",
												data: top.$('#addCancelResonForm').serialize(),
												success: function(data){
													if(data =="success"){
														top.$.messager.alert("提示",'提交成功','info',function(){
															$('#listProjectsTable').datagrid('reload');
															top.$('#firstLevelDialog').dialog('close');
															//top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
														});
													} else {
														top.$.messager.alert('提示',"提交失败！合同上传失败，请重新上传!",'error');
													}
												},
												error: function(res){
													
												}
											});
										}
										}

									}
								,{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
									}}],
									onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
										//alert(2);
										top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
										afterClosed();
									}
							});
				 		top.$('#firstLevelDialog').dialog("center");
		}
		
		
		/**
		*项目详情
		*/
		function getProjectDetail(id){
			top.$('#firstLevelDialog').dialog({    
			    title:"项目详情",  
			    iconCls:'icon-view',
			    width: 1000,    
			    height: 580,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx}/business/projectmanage/getProjectDetail?projectId=" + id+"&roleId=bidder",
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{
						text:projectsParamObj.cancelButton,
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#firstLevelDialog').dialog('close');
						}}]
			});
			top.$('#'+projectsParamObj.showDialogId).dialog("center");
		}


		//关闭
		function afterClosed(){

			
			// 在弹出对话框内找到Uploadify插件，并隐藏之。
			//top.$.find('.upload').hide();

				// 在弹出对话框内找到Uploadify插件，并隐藏之。
			top.$.find('.upload').hide();

			// 将弹出对话框还原成弹出前的状态，并清空里面的内容。
		    top.$('#firstLevelDialog').dialog('destroy').empty();

			}
		
		/**
		 * 上传验收报告
		 */
		 function receivingReport(id){
				 		top.$('#firstLevelDialog').dialog({
				 			title:"上传验收报告",  
						    iconCls:'icon-view',
						    width: '600',    
						    height: '300',    
						    closed: false,    
						    inline : true,
						    cache: false,    
						    href: "${ctx}/business/projectmanage/buyer/receivingReport?projectId="+id,   
						    modal: true,
						    close: afterClosed,
							extractor : function(data){
								if($.trim(data) == "unLogin"){
									var msn = ''||i18n[''];
									msn = msn||i18n[data];
									if(msn != undefined){
										top.$.messager.alert('提示',msn,'info',function(){top.location='${ctx}/user-login-sys-new/loginPwd';});
										return '';
									}
								}
								return data;
							},
						    buttons : [{text:'提交',
									iconCls:'icon-ok',
									handler:function(){
										if(top.$("#budgetMenuData").val()==''){
											top.$.messager.alert('提示',"报告附件不能为空！",'info',function(){});
											return;
										}
										top.$('#commitEntityBt').linkbutton('disable');
										if(top.$('#addApproveResonForm').form('validate')){
											$.ajax({
												type: "POST",
												timeout:20000,
												url:  "${ctx}/business/projectmanage/uploadReceivingReport",
												data: top.$('#addCancelResonForm').serialize(),
												success: function(data){
													if(data =="success"){
														top.$.messager.alert("提示",'提交成功','info',function(){
															$('#listProjectsTable').datagrid('reload');
															top.$('#firstLevelDialog').dialog('close');
															//top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
														});
													} else {
														top.$.messager.alert('提示',"提交失败！",'info');
													}
												},
												error: function(res){
													
												}
											});
										}
										}

									}
								,{
									text:'取消',
									iconCls:'icon-cancel',
									handler:function(){
										top.$('#firstLevelDialog').dialog('close');
									}}],
									onClose : function(){// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
										//alert(2);
										top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
										afterClosed();
									}
							});
				 		top.$('#firstLevelDialog').dialog("center");
		}
		
		
		


		//===============================================================
		/**打印中标通知书**/
		function printWinbidAlert(id){
			window.open("${ctx}/business/projectmanage/bidder/winbidAlertPrint?projectId="+id);
		}
		
		
		/**
		*投标人投标资格校验
		*/
		function bidValidate(paramObj,projectId){
			//检查是否安装了flash
			var fls = flashChecker();
			if (!fls.f){
				top.$.messager.alert('提示',"您未安装flash，请安装flash后，再进行投标!",'error',function(){
					window.open("https://get2.adobe.com/cn/flashplayer/?no_redirect", "_blank");
				});
				return;
			}


			$.ajax({
				type: "POST",
				timeout:20000,
				url:  "${ctx}/business/projectmanage/bidder/bidValidate?projectId="+projectId,
				success: function(data){
					if(data=="success"){
						shot(paramObj,projectId);//投标方法调用
					}else if(data=='nobid'){
						top.$.messager.defaults = { ok: "继续", cancel: "放弃" };
						top.$.messager.confirm('提示',"您单位曾有违规行为，参与须谨慎！",function(data){
							if(data){
								shot(paramObj,projectId);//投标方法调用
							}
						});
						top.$.messager.defaults = { ok: "确认", cancel: "取消" };
					} else if(data=='nosubmitbid'){
						top.$.messager.alert('提示',"投标失败！当前时间不能提交，请于开标前30分钟内提交!",'error');
					} else if(data=='exitbid'){
						top.$.messager.alert('提示',"投标失败！您已经投过标了!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=='noqualificabid'){
						top.$.messager.alert('提示',"投标失败！您未缴纳保证金!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=='noregqualificabid'){
						top.$.messager.alert('提示',"投标失败！您无此项目类型的投标资格!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=='atypism'){
						top.$.messager.alert('提示',"投标失败！银行户名与系统帐户名不一致!",'error',function(){
							$('#listProjectsTable').datagrid('reload');
							top.$('#firstLevelDialog').dialog('close');
						});
					}else if(data=="sealupNobid"){
                        top.$.messager.alert('提示',"投标失败！封存用户不能投标!",'error',function(){
                            $('#listProjectsTable').datagrid('reload');
                            top.$('#firstLevelDialog').dialog('close');
                        });
					}
					else{
						top.$.messager.alert("提示",'提交失败!');
					}
				},
				error: function(res){
					
				}
			});
		}
		
		/**打印验收报告*/
		function printReceivinReport(id){
			window.open("${ctx}/business/projectmanage/printReceivinReport?projectId="+id);
		}
		
		/**打印不评标项目验收报告*/
		function printNBReceivinReport(id){
			window.open("${ctx}/business/projectNb/printReceivinReport?projectId="+id+"&isShow=true");
		}
		
		/**
		*投标人撤销投标
		*/
		function cancelShot(id){
			top.$.messager.confirm('提示',"您确认要撤销投标吗！",function(data){
				if(data){
					$.ajax({
						type: "POST",
						timeout:20000,
						url:  "${ctx}/business/projectmanage/bidder/cancelShot?projectId="+id,
						success: function(data){
							if(data =="success"){
								top.$.messager.alert("提示",'撤销成功','info',function(){
									$('#listProjectsTable').datagrid('reload');
									top.$('#firstLevelDialog').dialog('close');
									//top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
								});
							} else {
								top.$.messager.alert('提示',"撤销失败！",'error');
								$('#listProjectsTable').datagrid('reload');
								top.$('#firstLevelDialog').dialog('close');
							}
						},
						error: function(res){
							$.messager.alert('提示',i18n.requestError,'error');
						}
					});
				}
			});
		}
		
		/**打印不评标项目中标通知书**/
		function printNBWinbidAlert(id){
			window.open("${ctx}/business/projectNb/printWinbidAlert?projectId="+id+"&isShow=true");
		}
</script>